package com.navi.loaddata.loadService.impl.Dcdata.cf;

import com.navi.loaddata.core.mesEntity.SpcDcResultData;
import com.navi.loaddata.core.mesEntity.SpcDcdata;
import com.navi.loaddata.core.mesEntity.SpcDcmeasuredataresult;
import com.navi.loaddata.core.mesEntity.SpcDcprocessdataresult;
import com.navi.loaddata.core.mysqlEntity.EtlConfD;
import com.navi.loaddata.core.mysqlEntity.EtlConfDModel;
import com.navi.loaddata.core.repository.impl.MesRepositoryImpl;
import com.navi.loaddata.core.util.ProcessUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

@Service
@Transactional(transactionManager = "mesPlatformTransactionManager")
public class LoadDcInfoServiceCF2 {

    @Autowired
    private MesRepositoryImpl mesdao;

    public List<SpcDcdata> loadDcDataList(EtlConfDModel etlConfD, String dctype) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        StringBuffer hql = new StringBuffer();
        hql.append("FROM SpcDcdata WHERE TIMEKEY >='")
                .append(sdf.format(etlConfD.getRunStartTimestamp()))
                .append("' and TIMEKEY < '")
                .append(sdf.format(etlConfD.getRunEndTimestamp()))
                .append("' and subfactoryname = '").append(etlConfD.getShop()).append("' ")
                .append(" and processoperationname not like 'DUM%' AND nvl(SUBSTR(PROCESSOPERATIONNAME, 6,7),'X') <> 'D'");
        if (!StringUtils.isEmpty(etlConfD.getOpe())) {
            hql.append(" and processoperationname = '").append(etlConfD.getOpe()).append("' ");
        }
        hql.append(" and dctype IN(").append(dctype).append(")");
        String hql1=hql.toString()+" and materialname in('C185E01UCD','C185G004BR','C185601JBC','C185F016AF','C185E01WAV','C185F02RAS','C185E01PBH','C185F02NAR','C185E01MCB','C184E00YCD','C185F02JBF','C185E01JAR','C185E01TAS','C185F018CE','C185G00BAN','C185G00UAC','C1852023BQ','C185F017AG','C185G00SAC','C185F015CH','C185F02MAW','C185F01EBL','C185800FBN','C185E01SAN','C185F01ABM','C185G002BB','C185F02KAW','C184N02EAY','C185E01PAD','C185701JBM','C185G00UBC','C185F02HBD','C185F01DBW','C185F02HBL','C185G00UAU','C185E01SAV','C185E01VCJ','C184W007BB','C185F02NCD','C185F02HBK','C185F02NBW','C185E01NBB','C185F02NCH','C185F02PBB','C185G008AN','C185501VBD','C185F02NBN','C185302EBS','C185E01HAB','C184P01KBD','C184N027AG','C185F02NBM','C185F02HAE','C184Q00CAA','C185E01VAM','C185E01PBU','C185F02KAV','C185G00RAT','C185D02GBV','C185G005BH','C185F02MAC','C185E01SBH','C184U00WBL','C185F01BBE','C185E01SAX','C185F01BAM','C184Q01LAU','C185F01CCE','C185E01MBB','C1854012BR','C185E01MBY','C185F02JAA','C185G003CG','C184V00PAJ','C185G005AK','C185E01PCJ','C185E01MCD','C184W006AU','C185F02PCE','C185401BBS','C185G00RCK','C185F01EAG','C185E01QAB','C184W006BQ','C185F02HAX','C185G008AM','C185E01XAX','C185100RBS','C185G007CG','C185201RBP','C185E01HBT','C185E01PAJ','C185E01QCH','C185F02LAV','C185E01QBY','C185G007BU','C184V016CF','C185E01QBT','C185E01KBK','C185F019AJ','C185F02PCK','C185900CBH','C185F02RBN','C185E01PCD','C185G007BG','C184V00AAG','C185201CAY','C185E01VAF','C185E01LBW','C184N00LAG','C184L029AV','C184V00UAX','C185601YCG','C185F02PBW','C185F02PAQ','C185F02KBT','C185G002AA','C185F02NAA','C184A003AN','C184Q02QAY','C185F02LCK','C185F01BBP','C185G00RBJ','C185302LBC','C185E01MAC','C185F017CK','C185G008AG','C184M00CBE','C185E01RBU','C185E01KBE','C185E01XAW','C185E01XAD','C185E01MAN','C184B00RCG','C185700NAW','C185E01SBY','C185F01UAC','C185E01HAR','C185F02MAL','C185E01RCK','C185E01WCK','C185E01RCA','C185E01TAT','C185F018BV','C185F016AQ','C1852024AA','C185F017AR','C185F02HAD','C185F02JBH','C185300PBQ','C185E01MAG','C185G007AL','C185E01RAS','C185E01JBN','C185E01LBV','C184L019BU','C185F01EAC','C185F02QCG','C185E01RAD','C185E01QAC','C185F01EAX','C185900XAL','C185E01LAM','C185G008AC','C185G00BAC','C185E01SBF','C184A01MAC','C185G006CA','C184V00TCJ','C184W00XAX','C185E01LAE','C185F015BN','C185E01XAQ','C184Q02SAV','C184W00VBW','C185F02NAB','C185F017BP','C184W00VCE','C185100MCC','C184T00RAD','C185G005CH','C185F01ACD','C185E01LBF','C185F02PBL','C185G008AW','C185F016AR','C185E01VAV','C184Q02NAD','C185800BAD','C185G008AY','C185F015CC','C184T00MAV','C185F02QBS','C185F02QCD','C185F01ABD','C185F02NBE','C1856008AR','C184S00UAY','C185401DBR','C185A012AY','C1856009BH','C185J01LCB','C184W00YBM','C185K01MAP','C1855013BH','C185501QCB','C185302FAA','C185600FAP','C185800YBS','C184P00GAJ','C184M029BA','C185800YAR','C184H00ACD','C1856011BP','C1856008BD','C184P00LBA','C185L01KAQ','C185E01VAW','C184W00FAC','C185G004AR','C185D02GAH','C185G00AAR','C185E01UAQ','C185E01XBJ','C185G002AP','C185F02MBD','C185F01DBX','C185F01ECG','C185E01WCG','C185F019AY','C185F019BE','C184N026BG','C185F01BAX','C184H00YCD','C185700NAP','C185F01AAR','C185E01LAT','C185F02QBV','C185F02MBA','C185G002AQ','C185E020CD','C185E01PBK','C185F02KAA','C185D02GAN','C185G002BQ','C185F02QBY','C185D02GAW','C183800YBE','C185F01CBR','C184W00FAA','C185F017BC','C185G009AW','C184V008AQ','C185F01EAD','C184P02BAU','C184F00UAT','C185F02PBV','C185401BAF','C185G003BM','C185G009CF','C185302FAW','C185F02GAG','C185G00RBC','C185E01MAV','C185F02NCJ','C184T00TBH','C185E01PAK','C184Q014BN','C185E01JAK','C185F02RBW','C184S00RAX','C184M02BBR','C185G002CD','C185F02LAD','C185600FAL','C185J01MAJ','C185R012BC','C185401HBH','C185100QBQ','C1855022BG','C185Q00YAH','C185601EBU','C185101GBV','C185201RBS','C185B00DAG','C185R01HBE','C185K01GBL','C185100NBW','C185700EBB','C1852023AC','C185M03BCH','C185300PBH','C1856024BU','C185B011AB','C185J01HCK','C184P01NAU','C184V00ACB','C185B00VBK','C185500YCA','C185501UBK','C185N014AJ','C1858010CJ','C185501MCJ','C185C029AY','C1858011AF','C185501WBM','C182Q00RAV','C185700QCD','C1859010BE','C185F02QBU','C185500FCJ','C185D01VAJ','C185Q02RBL','C185R02AAL','C185302GAA','C184V009BU','C185A00YBV','C185600MBJ','C185401HAX','C1856023BB','C185T01SCB','C185600BAQ','C185Q026AW','C185M008CJ','C185100UAA','C185500BAQ','C1854019BL','C185L01FBY','C185R026AK','C185B00YAF','C185800YBF','C185K016AN','C184T00RAC','C185R00YAM','C185K01GBH','C186100PBQ','C185G01CAE','C185101BAE','C185201MBM','C1852023CE','C185800EBD','C185501LCG','C184V008CK','C185Q028AJ','C185601JCF','C185M00EBG','C185100TBK','C1858014CG','C185Q026AL','C185L01HAY','C185901YAN','C184V00WCG','C185R028AV','C185G01NCA','C185T01TBE','C185B00UAD','C185R00WCG','C1855023AN','C1856020BA','C185U00MCG','C184T00KBS','C185Q02QCF','C185601GBF','C185C016BA','C184V00VAK','C185M00BBB','C185200FBQ','C1859009BU','C185P02LAQ','C1853026AE','C184P01FAF','C184V005AS','C185P006AU','C184M00CAS','C185A00HCE','C185A019CG','C185R01FBB','C185C029AW','C183L00GCA','C185P017AH','C185E01JBB','C185201RBJ','C185800XBS','C185E01KAM','C185601JBV','C184Q01LCE','C185F02JBX','C185200EAS','C185E01HAT','C184L00RAH','C185F02JAE','C185E01VBV','C185E01KBV','C185E01XCD','C184G02JAA','C185E01VAE','C185F01BBB','C185F01BCC','C185F018AG','C185700NBD','C185F01EBU','C185E01KAJ','C185701DBP','C185F017BJ','C185F02NBG','C185F01ECD','C185G003BA','C185F01ECH','C184N026CA','C185G004CK','C185F02JAP','C184W01AAM','C184T00RAM','C185G007BL','C185F02PAR','C184W008BF','C185G002BG','C185F019BR','C184N01MAK','C185G008AA','C185F01CCF','C1852021AT','C185F02KCD','C184J01LAV','C185C022BC','C185F02PAS','C184W007CG','C185800BBC','C185F02NCF','C185100MCE','C185E01SBD','C185G009AV','C185G004AM','C185F02KAF','C185G00UAD','C185F016BB','C185E01QBM','C185G003AL','C185F02JBU','C185E01MBC','C185E020BJ','C185F02PAJ','C185F02PAG','C185E01MBX','C185F01ABE','C185F02KCJ','C185F02PCD','C185E01WAR','C185G005BN','C185F02JAB','C185200FAA','C185F01ACB','C185E01MCG','C185F01AAC','C184G00BBX','C183Q01MBX','C185E01LBU','C184V00PBK','C184L007BT','C184U00FCK','C185F02QBH','C185E01TAQ','C185G00RAC','C185G00AAL','C185F02NBA','C185E01UBB','C185F02MCH','C184C018AB','C185E01NBC','C185F02MBR','C183D00EAE','C185E01PAU','C184W010AJ','C185E01XCB','C185F02JBR','C185F018CF','C184N026CB','C185G003BN','C185600NAS','C185B00UAC','C185A00XBD','C185M03DAY','C185302NBP','C185J01LAC','C185F01CAM','C185101ECD','C185G009AX','C185400LBC','C185F017BK','C184S00CBT','C185F01AAH','C184S00SBG','C185F019AP','C185E01JAM','C185D01QAD','C1859011AL','C185E01VCE','C185G003AB','C185701BBB','C183F00XBJ','C185C01SAW','C185500QBF','C1856025AV','C185C01RAT','C185800YAY','C185501MCK','C1853028AF','C185B00GAA','C185700MCE','C185D01QAP','C185A00GBM','C1857004AV','C185P02VBF','C1858011CK','C1853029AK','C1834004BG','C185701JAF','C185302NAD','C185401LCC','C185A01GBH','C182Q00SBC','C185D01WAR','C185G00BBR','C185E01HAY','C185E01JBE','C185E01KAL','C185G003BB','C185G00AAE','C185E01MBT','C184P01YAF','C185G00ACD','C185E01NAN','C185G009AR','C185G007AM','C185201QAH','C185E01JCB','C185G00ABV','C185E01MBV','C185G004AE','C185G004BQ','C185E01MBM','C185E01NBA','C185G00AAJ','C184Q02SAB','C185F02LAW','C1859009BY','C185F015BY','C185E01HBL','C185E01VCD','C185900ABM','C185E01XBW','C184W00GCG','C185F02GBN','C185G004BY','C185F02LBF','C185E01LBS','C185G00BAB','C185F01ABS','C1855023AU','C185600PAW','C185G007BD','C185F02KCK','C185E01LAF','C185G00RCH','C185F016AH','C1853028BR','C185501UBC','C185F01AAL','C185G007AS','C185G00BBQ','C185G00ACF','C185G009BB','C185F02GCC','C185E01WAU','C185G002BK','C185F02RBH','C185G00BAS','C185F02RAJ','C185F02LAM','C185G004AW','C184V019AD','C184S00UBU','C185E01PAN','C185G00SAK','C185E01MAA','C185800VBA','C185G009CJ','C185E01LBJ','C1858014AM','C185E01VBX','C184U00RAX','C185F02HBQ','C185G00UBN','C185E01RBH','C185F018BF','C185E01MCA','C185E01VBP','C185G004CF','C1857019BR','C185E01UAR','C185G00BCK','C185G00UCB','C185F02QCK','C185F01BBK','C185G008BU','C185E01VCB','C185F01DAJ','C185G006AA','C185E01QCE','C185E01SAP','C185G009BF','C1834009CG','C184900ABK','C185E01MAX','C185F02JCH','C185F02LBY','C185E01NAA','C185E01JCG','C185G007AD','C185D02GBH','C185G00BCF','C185E01MBK','C185302EBT','C185F02RBM','C185G005AX','C185G00ABX','C185G008BJ','C185E01LBP','C185G003BW','C185E01SBN','C185701HCE','C185501LBB','C184Q02SAM','C185E01VBS','C185F01BAS','C185E01VBK','C185F01AAE','C184V01NAD','C1854013AT','C185601MAF','C185E01QCA','C185G008CG','C185F02PBC','C185F015AC','C185E01UCB','C185F02HAS','C185G007AR','C185E01TAE','C185F017AN','C185F017AP','C185G00BAD','C185F02JBE','C185F01CAG','C1851018AR','C185E01NBV','C185E01HBF','C1855023AD','C185E01PAP','C185F019BG','C185F016BT','C185G007AU','C185G002BH','C185E01PAY','C185F02MCG','C185F019CB','C185F01EAW','C185F01BAV','C185F02GAR','C185E01HBA','C185700RAH','C185E01VCH','C185G007AP','C185D02GAD','C184V00UBN','C185F02HBX','C185G008AP','C184W00ABT','C184P020AT','C185G00ABU','C185F02RCK','C185F02GBU','C185F02RAN','C185E01UAW','C185G00AAN','C185E01WCE','C185G005BB','C185G00AAD','C185F01DBF','C185F01EAP','C185E01HBV','C185E01JBU','C185F02KBF','C185F02NBC','C185F02HCF','C185700RCC','C185F01BCF','C185E01LBQ','C185G009CH','C184U00DAH','C185E020BM','C185301VBT','C185E01PBG','C184U00WBP','C185F02NBS','C185G008CC','C184V00WBU','C185E01NBH','C185201BBE','C185101ACB','C182K001CC','C185201BAD','C185F018AP','C185F01CBH','C185601JBE','C185800DCF','C185G008BM','C182E005BJ','C184Q01KBF','C1855013BV','C184S00DBA','C184T00RCC','C184T00LAP','C184W01CCK','C185E01VAK','C185F019BJ','C185F018AW','C185G005AB','C185E020BY','C185E020AN','C185E01VBW','C185F015BK','C184H009CH','C185E01WBT','C185F02GCD','C185E01HCG','C185F02NAE','C185G003CD','C185F018AC','C185F02JAX','C185300MBC','C185F01AAP','C184U00RCA','C185E01HCK','C185F02MAG','C185E01XAA','C185E01RBK','C185E020BR','C184A01NAT','C185F02QBE','C185E01UBK','C185G006BU','C185G004AU','C185F01AAU','C185G008CA','C184V00WBC','C185G009BD','C185E01RCB','C185G00ABB','C185500EBD','C185G009AU','C185G008CD','C185301TBT','C185E01VAH','C185E01LAA','C185F02LBK','C1856027BG','C184W00GBF','C185F02KBY','C185E01TCB','C185F02GAT','C185G009BA','C185F02RBQ','C185F02NCB','C184T01FAF','C184T00NAS','C185G004BN','C185E01PBL','C185F01ACE','C185F01CAV','C185501MBP','C185300QCF','C185700DBY','C185N01YCH','C185A019BK','C185302KCB','C1853016AS','C185P00EBE','C1855011AW','C185400JBW','C185D01XCH','C184M022BR','C185M01NCD','C185K01ACD','C185101ECF','C185R00QBC','C185900AAV','C185A00KAT','C185Q035AC','C185601XBU','C185A01FBD','C185401DAJ','C185600QCD','C185901QBQ','C185401BBF','C185D02EBY','C1854011CK','C185501VAG','C1855020AN','C185400JCB','C184P01KAE','C185100UAE','C185500MCF','C185T01NCH','C185C018AD','C1855016CK','C185601CAG','C185T01QBE','C185901TBW','C185201EBP','C185Q01RCF','C1856025BM','C185800VBR','C185501WAM','C185800YBB','C185800FAU','C185600SAW','C1855008AB','C185101BBW','C185K017BJ','C185501PBG','C185800VBP','C185A00NCD','C185700DBD','C185D01YCB','C1855012AN','C1855017BV','C185501PAT','C1856027CF','C1851009BM','C185900CCG','C1855014BP','C185500PAU','C1851009AW','C185701JAM','C185A00JCD','C185901UAY','C1859011BL','C184W01AAJ','C1857019BD','C185701BCK','C185900AAE','C184W009AD','C185201RAW','C185401CBQ','C185800CCA','C185400LBY','C1855009AP','C1855008BC','C185600UAC','C185B011BP','C1855020BX','C1856014BS','C185401LCG','C185A00NBF','C185700DBH','C185600UAD','C1858013BC','C1852010AS','C185800DCH','C185A00KBA','C185B00VAS','C185700DBT','C185501WBR','C185500PAF','C1858011AU','C185700DBL','C185800BBS','C185101DBQ','C185301UBJ','C185600FAM','C185401DAG','C1857004BR','C185Q027AV','C1858012BT','C184E00XCK','C185701DAT','C185800WBK','C185401DBH','C185500DBV','C1855007AF','C185600NAR','C1855016BW','C1858012AX','C1853017BH','C185401LAP','C185101GBC','C185701EBJ','C1857019CJ','C185H02DCE','C185301TAG','C185601GBQ','C185701GCE','C185Q02YBL','C185601EBJ','C185R00VBD','C1852022AK','C185D01UBL','C185D00QBQ','C185200DAM','C185D00QBK','C185R012BY','C184Q003CD','C1855018AD','C185C02BCD','C185R00XBY','C1853027BS','C184Q006BM','C185401KAK','C184U00VAY','C184U00EBH','C184U00TAE','C185P02NCK','C185A00NCG','C185R023BQ','C185300PBA','C185U00CBE','C185100SBE','C185300NCK','C185101HAQ','C185201QAR','C185900XAH','C185401ABE','C185800YBV','C185K01HAA','C1853025CE','C185100SAS','C185600QCE','C185701GBD','C1856014AB','C185901XAG','C1856011BN','C185900XAT','C185A01EAL','C185501QAG','C185G00BCA','C185101HBG','C185600EAC','C185G004BJ','C185F01DBP','C185E01VBR','C185G009AL','C185U00ACD','C184Q01LBQ','C1858014BP','C185901UBA','C185901VCE','C1856023BA','C184D01HAW','C1856013CA','C185600QBU','C185R01FAE','C185P02PAV','C185T01NCC','C185101AAG','C185901XBC','C1859011BQ','C185901XAX','C185901XAT','C185901VAC','C185500YAE','C1855018BK','C185U008BV','C185200GAV','C1856027BJ','C185501VCE','C1855012AY','C185700MCF','C1857004BH','C185G01FBC','C185200GAQ','C185601MAR','C185T01SBH','C185Q037BR','C185901XAU','C185G00SBW','C185600NBA','C184N00MBS','C185301UAU','C184V008AV','C185U00NBR','C1855010BY','C185C022BY','C185901VBF','C1857003BH','C185400JBP','C185T01TBP','C1857006AB','C1856007AJ','C185R009BD')";
        String hql2=hql.toString()+" and materialname in('C1855023AM','C185B00SBA','C185T01PAH','C1854013CD','C185R009BC','C185800CBK','C185D01QBU','C184W008BY','C185D00LAV','C1855022AL','C1856006BB','C184Q01LCB','C185800YAF','C185100QBA','C185U00BBL','C185501QCF','C185600TBJ','C184S00SBA','C185301TAR','C1854015AK','C185M00GCA','C185M01NAG','C184U00BAR','C185M01SBH','C185P01BAJ','C1852028CH','C185L01PAT','C185P02PBS','C185H02CBE','C185Q01TBX','C185601CAL','C183L017AC','C185200FBX','C1852005BC','C184L02DBC','C185Q02RBP','C184901RAS','C183J00WAT','C1856012AD','C185Q01TCJ','C1852005BF','C185601JBX','C185J01LBK','C185R01HBG','C185500NCE','C185601MBG','C185101BCA','C185601KBQ','C1855017AQ','C185Q036BA','C185601HCD','C185T01SBK','C185101EAU')";
        List<SpcDcdata> list1=mesdao.list(SpcDcdata.class, hql1);
        List<SpcDcdata> list2=mesdao.list(SpcDcdata.class, hql2);
        if(!list2.isEmpty()) list2.forEach(e->list1.add(e));

        return list1;
    }

    public List<SpcDcResultData> loadMDataList(EtlConfDModel etlConfD, long dcdataid) {
        List<SpcDcmeasuredataresult> spcDcmeasuredataresultList =new ArrayList<>();
        List<SpcDcResultData> spcDcResultDataList=new ArrayList<>();
        StringBuffer hql = new StringBuffer();
        hql.append("FROM SpcDcmeasuredataresult WHERE dcdataid =").append(dcdataid)
        .append(" order by itemname, sitename");
        spcDcmeasuredataresultList =mesdao.list(SpcDcmeasuredataresult.class, hql.toString());
        spcDcmeasuredataresultList.forEach(e->{
            SpcDcResultData spcDcResultData=new SpcDcResultData();
            spcDcResultData.setDcdataid(e.getDcdataid());
            spcDcResultData.setSeq(e.getSeq());
            spcDcResultData.setSamplematerialname(ProcessUtil.processString(e.getSamplematerialname()));
            spcDcResultData.setItemname(ProcessUtil.processString(e.getItemname()));
            spcDcResultData.setSitename(ProcessUtil.processString(e.getSitename()));
            spcDcResultData.setSitetype(ProcessUtil.processString(e.getSitetype()));
            spcDcResultData.setAliasitemname(ProcessUtil.processString(e.getAliasitemname()));
            spcDcResultData.setDatatype(ProcessUtil.processString(e.getDatatype()));
            spcDcResultData.setResult(ProcessUtil.processString(e.getResult()));
            spcDcResultData.setEventname(ProcessUtil.processString(e.getEventname()));
            spcDcResultData.setTimekey(ProcessUtil.processString(e.getTimekey()));
            spcDcResultData.setEventtime(e.getEventtime());
            spcDcResultData.setEventuser(ProcessUtil.processString(e.getEventuser()));
            spcDcResultData.setEventcomment(ProcessUtil.processString(e.getEventcomment()));
            spcDcResultData.setUpdatetime(e.getUpdatetime());
            spcDcResultDataList.add(spcDcResultData);
        });
        return spcDcResultDataList;
    }

    public List<SpcDcResultData> loadPDataList(EtlConfDModel etlConfD, long dcdataid) {
        List<SpcDcprocessdataresult> spcDcprocessdataresult =new ArrayList<>();
        List<SpcDcResultData> spcDcResultDataList=new ArrayList<>();
        StringBuffer hql = new StringBuffer();
        hql.append("FROM SpcDcprocessdataresult WHERE dcdataid =").append(dcdataid)
                .append(" order by itemname, sitename");
        spcDcprocessdataresult =mesdao.list(SpcDcprocessdataresult.class, hql.toString());
        spcDcprocessdataresult.forEach(e->{
            SpcDcResultData spcDcResultData=new SpcDcResultData();
            spcDcResultData.setDcdataid(e.getDcdataid());
            spcDcResultData.setSeq(e.getSeq());
            spcDcResultData.setSamplematerialname(ProcessUtil.processString(e.getSamplematerialname()));
            spcDcResultData.setItemname(ProcessUtil.processString(e.getItemname()));
            spcDcResultData.setSitename(ProcessUtil.processString(e.getSitename()));
            spcDcResultData.setSitetype(ProcessUtil.processString(e.getSitetype()));
            spcDcResultData.setAliasitemname(ProcessUtil.processString(e.getAliasitemname()));
            spcDcResultData.setDatatype(ProcessUtil.processString(e.getDatatype()));
            spcDcResultData.setResult(ProcessUtil.processString(e.getResult()));
            spcDcResultData.setEventname(ProcessUtil.processString(e.getEventname()));
            spcDcResultData.setTimekey(ProcessUtil.processString(e.getTimekey()));
            spcDcResultData.setEventtime(e.getEventtime());
            spcDcResultData.setEventuser(ProcessUtil.processString(e.getEventuser()));
            spcDcResultData.setEventcomment(ProcessUtil.processString(e.getEventcomment()));
            spcDcResultData.setUpdatetime(e.getUpdatetime());
            spcDcResultDataList.add(spcDcResultData);
        });
        return spcDcResultDataList;
    }


    private String getOpeHql(String confOpe) {
        if (StringUtils.isEmpty(confOpe)) {
            return "";
        }

        StringBuffer hql = new StringBuffer();
        if ("*".contains(confOpe)) {
            //todo 允许模糊匹配
        } else {
            hql.append(" and opeId='").append(confOpe).append("' ");
        }

        return hql.toString();
    }


}
